<template>
<view class="loginbox">
  <div class="login">
    <div>
		<div class="text">用户名</div>
      <input v-model="username" name="uname" label="用户名" placeholder="请输入账号" />
		<div class="text">密码</div>
      <input v-model="password" type="password" name="upass" label="密码" placeholder="请输入密码" />

      <div class="button" @click="login">
        <button round block type="info" native-type="submit" >登录</button>
      </div>
	  <div class="button" @click="register">
		  <div round block type="info" native-type="submit"  class="logins">——— 去注册 ———</div>
	  </div>
    </div>

  </div>
</view>
</template>

<script>
	export default {
		data() {
			return {
				username:'',
				password:''
			}
		},
		methods: {
			register(){
				uni.navigateTo({
					url:"../register/register"
				})
			},
			login() {
				if(this.username.trim() !== '' && this.password.trim() !==''){
					uni.switchTab({
						url: "../pages/my/my"
					})
				}
				else{
					uni.showToast({
						title:'输入框不能为空',
						icon:'none'
					})
				}

				
			},
		}
	}
</script>

<style lang="less" scoped>
	.loginbox{
		height:100vh;
		margin-top:150px;
	}
	.login{
		margin:10px;
		
	}
	input{
		font-size:15px;
		margin:0px 0px 30px 20px;
		padding:10px;
		border-radius:25px;
	}
	.text{
		margin:10px;
		font-family:"华文行楷";
	}
	.button{
		margin:0px 60px;
	}
	.button button{
		font-size:15px;
		border:0px solid transparent;
		border-radius:30px;
		margin-bottom:30px;
		
		background-color:skyblue;
	}
	.logins{
		margin-top:60px;
		text-align:center;
		color:gray;
	}
</style>